﻿using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace VSTalk.Tools
{
    internal class SubscriptionJoiner : ISubscriptionJoiner, IEnumerable<ISubscription>
    {
        private readonly IList<ISubscription> _listeners = new List<ISubscription>();

        public void Join(ISubscription unit)
        {
            _listeners.Add(unit);
        }

        IEnumerator<ISubscription> IEnumerable<ISubscription>.GetEnumerator()
        {
            return _listeners.GetEnumerator();
        }

        public IEnumerator GetEnumerator()
        {
            return _listeners.GetEnumerator();
        }
    }
}